man.config.z ll man*-rw-r--r--1 root root 4617 Nov 17:14 man.config
example Three: compressing the man.config into another file to back up compress-c man.config > Man.config.back.z ll man*-rw-r--r--1 root root 4617 Nov 17:14 man.config-rw-r--r--1 root root 2684 Nov 17:24 Man.config.bac K.z# This-C option is more interesting! He will output the compression process data to the screen instead of writing it into # *. Z of the compression file. So. We are able to output data
Zcat command to view a compressed file in gzip formatZcat file.gz > Test.txt View the contents of a compressed file and import the contents into a file Test.txtThe Zcat command can also decompress the data and display the extracted file contents on the screen, but after running the Zcat command, the contents of the compressed file do not change and are still stor
man.config.z ll man*-rw-r--r--1 root root 4617 Nov 17:14 man.config
example Three: compressing the man.config into another file to back up compress-c man.config > Man.config.back.z ll man*-rw-r--r--1 root root 4617 Nov 17:14 man.config-rw-r--r--1 root root 2684 Nov 17:24 Man.config.bac K.z# This-C option is more interesting! He will output the compression process data to the screen instead of writing it into # *. Z of the compression file. So, we can export the data to
There are many Linux compression and packaging methods. The following describes the concepts of gzip and zcat commands, and lists examples of various Linux compression and packaging methods for your reference, hope to help you ....
Gzip and zcat commands[Root @ linux ~] # Gzip [-cdt #] File Name[Root @ linux ~] # Zcat file name .gz
Parameters:◆-C: Output compress
The previous article introduced the tar command of the Linux compression and decompression command. I believe that, for example, you should be familiar with the application of the tar command. Here we will continue to introduce the two Linux compression and decompression commands gzip, the zcat and bzip2 and bzcat commands are as detailed as above.
Gzip and zcat commands [Root @ linux ~] # Gzip [-cdt #] Fil
File compression and packaging in linux --- compress, gzip, zcat, bzip2, bzcat, tar, find, tarfile, tarball, --- compresszcatCommon Linux compressed file extensions
*. Z compress compressed files (replaced by gzip)
*. Gz gzip compressed files
*. Bz2 bzip2 compressed files (better than gzip, but only one file can be compressed)
* The data packaged by the. tar program is not compressed (using tar as a file can solve the problem that bzip2 cannot compres
File compression and packaging in linux --- compress, gzip, zcat, bzip2, bzcat, tar, find, tarfile, tarballCommon Linux compressed file extensions
*. Z compress compressed files (replaced by gzip)
*. Gz gzip compressed files
*. Bz2 bzip2 compressed files (better than gzip, but only one file can be compressed)
* The data packaged by the. tar program is not compressed (using tar as a file can solve the problem that bzip2 cannot compress multiple files)
CTime are later included.The--newer-mtime is only mtimeUse FIND/ETC-NEWER/ETC/PASSWD to find out more new filesTime to find a target fileTar-jcv-f/root/etc.tar.bz2 >--newer-mtime= "2011/10/3"/etc/*Tarfile,tarballtarfileOnly use the TAR directive to package files that are not compressedTarballFiles packaged and compressed using the TAR directiveMethods of using the TAR command to be/dev/st0 to a tape driveTar-cv-f/dev/st0/home/root/etcUsing pipeline command and data flow backupIt's the side pack
There are many compression tools in Linux, this article mainly introduces Gzip/gunzip/zcat, Bzip2/bunzip2/bzcat, tar, Zip/unzip.
For ease of presentation. We first set up a text file called "Test.txt", which reads as follows:
Hello!
This is a test!
End of file.
1. Gzip/gunzip/zcat
Gzip is used to compress common files; Gunzip is used to extract the compressed files that are created by gzip; Gcat is used t
To reduce the amount of space occupied by log files, in many cases we package the log files in days or weeks as tar.gz packages. While this is a good space to take advantage of, it is inconvenient when we want to look at the contents of a compressed package. If it's just a tar.gz file, unzip it, and then use grep, awk, or VI tools to view or process it. However, if there are one months or a year of log need to find some key words of the line, one of the decompression, and then look, is not very
!
ll man*-rw-r--r--1 root root 4617 Nov 17:14 man.config-rw-r--r--1 root root 2684 Nov 17:24 man.config.back.z# -c outputs data from the compression process to the screen instead of writing to # *. Z of the compression file. Therefore, the data can be exported to another file name through a data flow redirection method.
Compress has been used by very few people because compress cannot unlock *.gz files, and gzip can unlock *. Z's File
gzip, ZcatGzip can unlock
Jul 11:46 install.log.back.z# The parameter of-C is interesting, and he will output the data of the compression process to the screen instead of writing it into file. Z file. Therefore, we can export the data to another file name through a data flow redirection method. Example four: Compressing each file under the TMP directory [[emailprotected] tmp]# compress-r/tmp/This command compresses the TMP directory and every file in the subordinate directory. Z file, for this command with-R is used spa
1. gzip, zcat [root @ linux ~] # Gzip [-cdt #]? N parameters:-c: output compressed data to the screen, which can be processed through data stream redirection;-d: extracted parameters;-t: it can be used to check the consistency of a compressed file ~ Check whether the file has any errors.-#: compression level ,-
1. gzip, zcat
[Root @ linux ~] # Gzip [-cdt #]? NParameters:-C: outputs compressed data to the sc
Directory
(1) Zip
Compression, decompression and archiving tools There are many, today's small series on the collation of a few people are more commonly used.Compress gzip bzip2 XZZip tar cpioFirst,compression, decompression tools
usage Compact Tool
Compressed Compressed package format
Unzip (The source file is not retained by default)
-C: Print compressed results to the screen
Save compressed file extract *
what partition is used here. You can also simulate it. The following is a simulation step:
mkdir/data1/
cd/data1/
ddif=/dev/zeroof=disk1count=2048000
mkfs.ext3disk1
mkdir-p/dfs/a
mount-oloop/data1/disk1/dfs/a
Here, we use the/data Partition to copy some files first.
[root@localhost~]#]#cp/bin/ls/data/
[root@localhost~]#]#cp-rf/bin/data/
[root@localhost~]#]#ls-la/data/
total136
drwxr-xr-x4rootroot4096Apr2117:37.
drwxr-xr-x25rootroot4096Apr2117:11..
file in the compressed package
First, check the extracted file name.
Tar-z [j] tvf filename.tar.gz (bz2) | grep 'file name to be parsed'
Decompress the file
Tar-z [j] xvf source compressed package .tar.gz (bz2) file name to be extracted
5) package a directory, but not some files in the directory
You need to use the-exclude parameter.
For example, I want to back up the/etc and/root directories, but I don't want to package the files with the install switch, and I don't want to package the files
Document directory
Parameters
Option
Example
Tips
Compress and decompress files
Gzip [Options] [File-list]
Gunzip [Options] [File-list]
Zcat [File-list]
The gzip program is used to compress files, the gunzip program is used to restore gzip compressed files, and the zcat program is used to display gzip compressed files.
After compression, the original file will be deleted, and the compressed file su
each other. Therefore, when downloading a compressed file, you need to know which compression command is used to decompress the file. Although the attributes of a Linux file are basically irrelevant to the file name, the proper extension is necessary to help us identify the file. The following extensions are commonly used compressed files in Linux:
*. Z files compressed by the compress program; // This compression command is not supported by default in mainstream Linux versions, because the gzi
@ localhost SRC] # tar xfvz ext3grep-0.6.0.tar.gz[Root @ localhost ext3grep-0.6.0] #./configure[Root @ localhost ext3grep-0.6.0] # make install[Root @ localhost ext3grep-0.6.0] # ext3grepRunning ext3grep version 0.6.0Compile the program and test the program. After all the tasks are completed, start the recovery process.My directory is/Data Partition. I first formatted the partition. I put a file in the root directory and a file in a subdirectory./Dev/mapper/VolGroup00-LogVol02 1008 M 34 m 924 M
05 _ packaging and compression, 05 _ packaging and Compression
Note:
This blog is mainly about linux's most basic compression, decompression, and packaging operations)1. Common compression commands 1. compress (*. Z)
The old compression software can be replaced by gzip
Compress [-rcv] file or directory
Uncompress file. Z
-R: the files in the directory are compressed together.
-C: Output compressed data to the screen
-V: displays the compressed file information and file name changes during
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.